<?php
/**
 * Created by PhpStorm.
 * User: 小蛮哼哼哼
 * Email: 243194993@qq.com
 * Date: 2022/3/25
 * Time: 16:16
 * motto: 现在的努力是为了小时候吹过的牛逼！
 */

namespace app\common\model;

class SystemAdmin extends Base
{
    public function getAuthList()
    {
        $list = (new SystemAuth())
            ->where('status', 1)
            ->column('title', 'id');
        return $list;
    }

    /**
     * @param string $mobile
     * @return SystemAdmin|array|mixed|\think\Model|null
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public function getUserMobileByInfo(string $mobile = "")
    {
        return $this->where('phone', $mobile)
            ->find();
    }
    public function searchPhoneAttr($query,$value,$data){
        $query->where('phone',$value);
    }
    public function searchUsernameAttr($query,$value,$data){
        $query->where('username',$value);
    }
}